package com.jdf.exception;

import com.jdf.result.JSONResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public JSONResult result (Exception e){
        JSONResult jsonResult = new JSONResult();
        jsonResult.setMessage("正在抢救程序员");
        jsonResult.setCode("-1000111");
        return jsonResult;
    }

    @ExceptionHandler(GlobalCustomException.class)
    public JSONResult result (GlobalCustomException e){
        JSONResult jsonResult = new JSONResult();
        jsonResult.setMessage("运行时异常，不能为空");
        jsonResult.setCode("-669");
        return jsonResult;
    }


}
